package com.paas.form.core.model;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Collections;

@EqualsAndHashCode(callSuper = true)
@Data
public class Template extends ElementUI {


    public Template(int indentNum) {
        this.indentNum = indentNum;
    }

    @Override
    public void getElHtml(StringBuilder str) {

    }

    @Override
    public void getStartTagElHtml(StringBuilder str) {
        String codeTemplate = String.join("", Collections.nCopies(indentNum, "\t")) + "<template>";
        str.append(codeTemplate);
        str.append("\n");
        //添加Eldialog_start
        String codedialog = String.join("", Collections.nCopies(indentNum+1, "\t")) + "<el-dialog :title.sync=\"addOrEdit\" :visible.sync=\"showDialog\" width=\"60%\" :before-close=\"handleClose\">\n";
        str.append(codedialog);

    }

    @Override
    public void getEndTagElHtml(StringBuilder str) {
        //添加Eldialog_end
        String codedialog = String.join("", Collections.nCopies(indentNum+1, "\t")) + "</el-dialog>\n";
        str.append(codedialog);
        String codeTemplate = String.join("", Collections.nCopies(indentNum, "\t")) + "</template>";
        str.append(codeTemplate);
        str.append("\n");


    }
}